package com.lcxw.hxzbapi.service;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.lcxw.hxzbapi.dao.mapper.VipConfigMapper;
import com.lcxw.hxzbapi.entity.pojo.VipConfig;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Component;

@Component
public class VipConfigService {

    @Resource
    VipConfigMapper vipConfigMapper;

    public List<VipConfig> getAll() {
        return vipConfigMapper.selectList(null);
    }

    public int insert(VipConfig vipConfig) {
        return vipConfigMapper.insert(vipConfig);
    }

    public int deleteByVipType(String vipType) {
        UpdateWrapper<VipConfig> wrapper = new UpdateWrapper<>();
        wrapper.eq("vipType", vipType);
        return vipConfigMapper.delete(wrapper);
    }

    public int deleteById(int id) {
        return vipConfigMapper.deleteById(id);
    }
}
